<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class ProjectCompanies extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('project_companies', function (Blueprint $table) {
            $table->id()->from(config('migration.from'));

            $table->text('structure_details')->nullable();
            $table->text('persons_information')->nullable();
            $table->text('revenue')->nullable();
            $table->enum('finance_type', ['profit', 'lesion'])->default('profit')->comment('Прибыль/убыток');
            $table->text('finance')->nullable();

            $table->text('primary_occupation')->nullable();
            $table->text('additional_facts')->nullable();
            $table->year('foundation_year')->nullable();
            $table->string('site')->nullable();
            $table->boolean('no_site')->nullable();

            $table->bigInteger('logo_id')->unsigned()->nullable()->comment('Логотип');
            $table->foreign('logo_id')->references('id')->on('files')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('project_companies');
    }
}
